home *** CD-ROM | disk | FTP | other *** search
/ Delphi Developer's Kit 1996 / Delphi Developer's Kit 1996.iso / power / wsanet8a / wsanet / vbsmtpd / vbsmtpd.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-22  |  6.7 KB  |  203 lines

  1. VERSION 2.00
  2. Begin Form Main 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "VB-SMTPD"
  5.    ClientHeight    =   3375
  6.    ClientLeft      =   1035
  7.    ClientTop       =   1740
  8.    ClientWidth     =   5430
  9.    Height          =   4035
  10.    Icon            =   VBSMTPD.FRX:0000
  11.    Left            =   990
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   3375
  14.    ScaleWidth      =   5430
  15.    Top             =   1125
  16.    Width           =   5520
  17.    Begin CommonDialog CMDialog 
  18.       Left            =   4920
  19.       Top             =   2520
  20.    End
  21.    Begin CommandButton BtnFilename 
  22.       Caption         =   "No mailbox configured."
  23.       Height          =   375
  24.       Left            =   120
  25.       TabIndex        =   5
  26.       Top             =   600
  27.       Width           =   4695
  28.    End
  29.    Begin SSFrame FrameListHosts 
  30.       Alignment       =   2  'Center
  31.       Font3D          =   2  'Raised w/heavy shading
  32.       Height          =   1905
  33.       Left            =   120
  34.       ShadowStyle     =   1  'Raised
  35.       TabIndex        =   3
  36.       Top             =   960
  37.       Width           =   4695
  38.       Begin ListBox ListHosts 
  39.          Height          =   1590
  40.          Left            =   90
  41.          TabIndex        =   4
  42.          Top             =   180
  43.          Width           =   4515
  44.       End
  45.    End
  46.    Begin SSPanel StatusBar 
  47.       Align           =   2  'Align Bottom
  48.       Alignment       =   0  'Left Justify - TOP
  49.       AutoSize        =   3  'AutoSize Child To Panel
  50.       BackColor       =   &H00C0C0C0&
  51.       BevelInner      =   1  'Inset
  52.       BorderWidth     =   1
  53.       Caption         =   "Ok."
  54.       Font3D          =   3  'Inset w/light shading
  55.       Height          =   300
  56.       Left            =   0
  57.       TabIndex        =   1
  58.       Top             =   3075
  59.       Width           =   5430
  60.    End
  61.    Begin SSPanel PanelHostName 
  62.       Align           =   1  'Align Top
  63.       Alignment       =   6  'Center - TOP
  64.       BackColor       =   &H00C0C0C0&
  65.       BevelWidth      =   2
  66.       Caption         =   "PanelHostName"
  67.       Font3D          =   4  'Inset w/heavy shading
  68.       Height          =   495
  69.       Left            =   0
  70.       TabIndex        =   0
  71.       Top             =   0
  72.       Width           =   5430
  73.       Begin Label LabelHostAddr 
  74.          Alignment       =   2  'Center
  75.          BackColor       =   &H00C0C0C0&
  76.          BackStyle       =   0  'Transparent
  77.          Caption         =   "LabelHostAddr"
  78.          FontBold        =   0   'False
  79.          FontItalic      =   0   'False
  80.          FontName        =   "MS Sans Serif"
  81.          FontSize        =   8.25
  82.          FontStrikethru  =   0   'False
  83.          FontUnderline   =   0   'False
  84.          Height          =   195
  85.          Left            =   0
  86.          TabIndex        =   2
  87.          Top             =   240
  88.          Width           =   5460
  89.       End
  90.    End
  91.    Begin NetClient NetClient 
  92.       Index           =   0
  93.       Left            =   4950
  94.       LineDelimiter   =   ""
  95.       RecvSize        =   4096
  96.       RecvThreshold   =   0
  97.       RemoteService   =   ""
  98.       Top             =   2070
  99.    End
  100.    Begin Ini Ini 
  101.       Left            =   4950
  102.       Top             =   1620
  103.    End
  104.    Begin NetServer NetServer 
  105.       Left            =   4950
  106.       QueueSize       =   0
  107.       Top             =   1170
  108.    End
  109.    Begin Menu MnuSetup 
  110.       Caption         =   "&Setup"
  111.    End
  112.    Begin Menu MnuAbout 
  113.       Caption         =   "&About"
  114.    End
  115. Option Explicit
  116. Sub BtnFilename_Click ()
  117.     On Error Resume Next
  118.     CMDialog.CancelError = True
  119.     CMDialog.DefaultExt = ".mbx"
  120.     CMDialog.DialogTitle = "VB-SMTPD - Mailbox file"
  121.     CMDialog.Filename = msMailFile
  122.     CMDialog.Filter = "Mailbox files (*.mbx)|*.mbx|Everything (*.*)|*.*"
  123.     CMDialog.FilterIndex = 1
  124.     CMDialog.Flags = OFN_PATHMUSTEXIST
  125.     CMDialog.Action = 1
  126.     If Err <> 32755 Then
  127.         msMailFile = CMDialog.Filename
  128.         BtnFilename.Caption = "&Mailbox: " & msMailFile
  129.         Ini.Entry = "Mailbox"
  130.         Ini.Value = msMailFile
  131.     End If
  132. End Sub
  133. Sub Form_Load ()
  134.     'Ctl3d_Load
  135.     If NetClient(0).HostName <> "" Then
  136.         PanelHostName = NetClient(0).HostName
  137.         LabelHostAddr = NetClient(0).HostAddr
  138.     Else
  139.         PanelHostName = "LocalHost"
  140.         LabelHostAddr = "unable to retreive local address"
  141.     End If
  142.     Ini.Default = ""
  143.     Ini.Filename = "vbsmtpd.ini"
  144.     Ini.Section = "Configuration"
  145.     Ini.Entry = "Mailbox"
  146.     msMailFile = Ini.Value
  147.     If msMailFile = "" Then
  148.         BtnFilename.Caption = "&Mailbox: None - Popup"
  149.     Else
  150.         BtnFilename.Caption = "&Mailbox: " & msMailFile
  151.     End If
  152.     gSMTPStartup NetServer
  153.     Ini.Section = "Windows"
  154.     Main.Top = gfMISCIniGetInt("Main.Top", (Main.Top))
  155.     Main.Left = gfMISCIniGetInt("Main.Left", (Main.Left))
  156.     Main.Width = gfMISCIniGetInt("Main.Width", (Main.Width))
  157.     Main.Height = gfMISCIniGetInt("Main.Height", (Main.Height))
  158.     Main.Show
  159. End Sub
  160. Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  161.     If UnloadMode = 0 Then
  162.         Ini.Section = "Windows"
  163.         gsMISCIniPutInt "Main.Top", (Main.Top)
  164.         gsMISCIniPutInt "Main.Left", (Main.Left)
  165.         gsMISCIniPutInt "Main.Width", (Main.Width)
  166.         gsMISCIniPutInt "Main.Height", (Main.Height)
  167.     End If
  168.     gSMTPCleanup
  169.     'Ctl3d_UnLoad
  170. End Sub
  171. Sub Form_Resize ()
  172.     If Main.WindowState = 1 Then Exit Sub
  173.     LabelHostAddr.Width = ScaleWidth
  174.     BtnFilename.Width = Abs(ScaleWidth - 240)
  175.     FrameListHosts.Width = Abs(ScaleWidth - 240)
  176.     FrameListHosts.Height = Abs(ScaleHeight - FrameListHosts.Top - StatusBar.Height - 120)
  177.     ListHosts.Width = Abs(FrameListHosts.Width - 240)
  178.     ListHosts.Height = Abs(FrameListHosts.Height - 240)
  179. End Sub
  180. Sub MnuAbout_Click ()
  181.     gsMISCAboutLoad "About VB-SMTPD", "VB-SMTPD v1.1", "This is a multi-connection SMTP server (normally port 25). You should configure a mailbox to hold incoming mail."
  182. End Sub
  183. Sub MnuSetup_Click ()
  184.     Load Setup
  185.     Setup.Show
  186. End Sub
  187. Sub NetClient_OnError (Index As Integer, iErrorNumber As Integer)
  188. Dim sTemp As String
  189.     sTemp = NetClient(Index).ErrorMessage
  190.     gSMTPError -1, iErrorNumber, sTemp
  191. End Sub
  192. Sub NetClient_OnRecv (Index As Integer)
  193.     gSMTPReceive Index
  194. End Sub
  195. Sub NetServer_OnAccept (Socket As Integer, PeerAddr As String, RemotePort As Integer)
  196.     gSMTPAccept Socket, PeerAddr, RemotePort
  197. End Sub
  198. Sub NetServer_OnError (iErrorNumber As Integer)
  199. Dim sTemp As String
  200.     sTemp = NetServer.ErrorMessage
  201.     gSMTPError -1, iErrorNumber, sTemp
  202. End Sub
  203.